var ajaxfilemanagerurl = '/js/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php';
tinyMCE.init({
	language: "ru",
	mode : "textareas",
	//elements : "item[content],item[description],item[keywords]",
	theme : "advanced",
	skin : "o2k7",
	skin_variant : "silver",
	plugins : "table,save,advhr,advimage,advlink,preview,searchreplace,contextmenu,paste,fullscreen,nonbreaking, inlinepopups,ajaxfilemanager,media",
	// Theme options
	theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,|preview,|,forecolor,backcolor",
	theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,visualchars,media,nonbreaking,|,advhr,|,fullscreen",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	theme_advanced_resize_horizontal : false,
	theme_advanced_resizing : true,
	document_base_url : "/",
	content_css : "/css/editor.css",
	relative_urls : false,
	file_browser_callback : "ajaxfilemanager",
	remove_script_host : true
});
function ajaxfilemanager(field_name, url, type, win) {
	switch (type) {
		case "image":break;
		case "media":break;
		case "flash":break;
        case "file":break;
		default:return false;
	}
    tinyMCE.activeEditor.windowManager.open({
        url: ajaxfilemanagerurl,
        width: 800, height: 470, inline : "yes", close_previous : "no"
    },{window : win, input : field_name});
}